#include <WinConfigDefs.h>
// _finite
#include <float.h>
#include <stdint.h>

#ifdef __cplusplus
extern "C" {
#endif

//int time(time_t* t);
/*
tm* gmtime_r(const time_t*, const tm* numSecs);
tm* localtime_r(const time_t*, const tm* numSecs);
int strftime(char* str, int len, const char*, tm* calTime);
int gettimeofday(timeval* tp, timezone* tzp);
//char *tzname[];
time_t mktime(const tm*);
*/
void *mmap(void *, size_t, int, int, int, long);
int munmap(void *, size_t);
void syslog(int,char*,...);
int close(int);
int open(char const *,int,...);

int msync(char*,...);

#if defined(__VISUAL_STUDIO)
int read(int, void *, int);
int write(int,void const *,int);
int lseek(int,int,int);
#endif

#if !defined(MS_LITTLE_ENDIAN)
#define htons(A)  (A)
#define htonl(A)  (A)
#define ntohs(A)  (A)
#define ntohl(A)  (A)
#else
#define htons(A)  ((((uint16_t)(A) & 0xff00) >> 8) | \
                   (((uint16_t)(A) & 0x00ff) << 8))
#define htonl(A)  ((((uint32_t)(A) & 0xff000000) >> 24) | \
                   (((uint32_t)(A) & 0x00ff0000) >> 8)  | \
                   (((uint32_t)(A) & 0x0000ff00) << 8)  | \
                   (((uint32_t)(A) & 0x000000ff) << 24))
#define ntohs     htons
#define ntohl     htonl
#endif

#ifdef __cplusplus
}
#endif
